package com.zgm.ch06.aop.aspectJ.advice.argumentBind._2_6;

import java.math.BigDecimal;
import java.util.Date;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;

@Aspect
public class BindingAspect {

	@Around(value = "execution(* com.zgm.ch06.aop.services.StockService.*(..))" +
					" && args(cutoffDate, minimunDiscount)",
			argNames = "pjp, cutoffDate, minimunDiscount")
	public Object discountEnforcement(ProceedingJoinPoint pjp, Date cutoffDate, 
									  BigDecimal minimunDiscount) throws Throwable {
		
		System.out.println("前:cutoffDate=" + cutoffDate + " minimunDiscount=" + minimunDiscount );
		Object ret =  pjp.proceed();
		System.out.println("后:cutoffDate=" + cutoffDate + " minimunDiscount=" + minimunDiscount );
		
		return ret;
	}
}
